function compileMap(self)
{
	self.Map = Class.create(
	{
		/**
		 * Constructor.
		 * 
		 * @param mapDiv Div to hold the map.
		 * @param location google.maps.LatLng.
		 * @param zoom Zoom level
		 * @param mapTypeId Type of map, e.g.: google.maps.MapTypeId.ROADMAP
		 * @param title The title of the marker.
		 * @param markerText The text to display above the marker.
		 */
		 initialize: function(mapDiv, location, zoom, mapTypeId, title, markerText)
		 {
		 	// Setup map and marker.
		 	var myOptions = {zoom: zoom, center: location, mapTypeId: mapTypeId};

		 	// Create map.
		 	this.map = new google.maps.Map(mapDiv, myOptions);
		 	
		 	// Place marker.
		 	this.placeMarker(location, title, markerText);
		 	
		 	// Add event listener to map clicks.
		 	google.maps.event.addListener(this.map, 'click',
		 	    function(self)
		 	    {
		 	    	return function(event)
		 	        {
                        self.placeMarker(event.latLng);
                    };
		 	    }(this));
		 },
		 
		 /**
		  * Places a marker at the specified position.
		  * 
		  * @param location The location.
		  * @param title The title of the marker.
		  * @param markerText The text to display above the marker.
		  * @param centerOnMarker Whether or not to center the map on the updated marker position.
		  */
		 placeMarker: function(location, title, markerText, centerOnMarker)
		 {
		 	// Create new marker or move existing marker.
		 	if (this.marker)
		 	{
		 		this.marker.setPosition(location);
		 		this.infoWindow.close();
		 		if (centerOnMarker)
		 		{
		 			this.map.setCenter(location);
		 		}
		 	}
		 	else
		 	{
		 		this.marker = new google.maps.Marker({position: location, map: this.map, title: title, clickable: false, draggable: true});
		 		this.infoWindow = new google.maps.InfoWindow({content: markerText});
		 		this.infoWindow.open(this.map, this.marker);
		 	}
		 },
		 
		 /**
		  * Gets the location from the marked position on the map.
		  */
		 getLocation: function()
		 {
		 	return this.marker.getPosition();
		 }
	});
}